<?php
require_once('config.param.php');
class Param_tagController extends Gaf_Controller_Action {
	/**
	 * @name 参数设置
	 * @menu 参数设置/主题标签
	 * @comment 标签管理，设置主题标签
	 * @type WEB
	 */
	public function indexAction(){
		$t=new db_recordset(NULL,"zyw_scenic_subject");
		$sql="select * from zyw_scenic_subject";
		$t->query($sql,-1);
		$arr=$t->getRecords();
		$this->view->subArr=$arr;
	}
	public function addsubjectAction(){
		$name=$this->_getParam('name');
		if($name!=''&&$name!=null){
			$t=new db_table(NULL,'zyw_scenic_subject');
			$t->insert();
			$t->subject=$name;
			$t->pv=0;
			$t->post();
			$this->_redirect("/param/tag/index?errmsg=添加成功");
		}	
	}
	public function delsubjectAction(){
		$this->_helper->viewRenderer->setNoRender();
		$len=$this->_getParam('len');
		$t=new db_recordset('zyw_scenic_subject');
		for ($i=0;$i<$len;$i++){
			$subid=$this->_getParam("chk-".$i);
			//debug::output(1,$subid);
			if($subid!=''&&$subid!=null){
				$sql="delete from zyw_scenic_subject where subid=$subid";
				$t->exec($sql);
				$sql0="delete from zyw_subject_relation where subid=$subid";
				$t->exec($sql0);
			}
		}
		$this->_redirect("/param/tag/index?errmsg=删除成功");
	}
}